﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Configuration;
using KPIS.DBM;
using KPIS.GERP.ESS.MODEL;

namespace KPIS.GERP.ESS.DAL
{
    class D_FIM_MoneyRequestTravelers
    {
        ConvertNullable.ConvertNullable cn = new ConvertNullable.ConvertNullable();

        public void Insert(string traveler_seq, string money_req_seq, string emp_seq, string contact_seq
            , string contact_person_seq, string job_site_seq, string pos_seq
            , string class_seq, string old_class_seq, string record_status, string created_by)
        {
            string strSQL;
            DBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            try
            {
                dbManager.Open();
                dbManager.CreateParameters(11);

                dbManager.AddParameters(0, "@traveler_seq", traveler_seq);
                dbManager.AddParameters(1, "@money_req_seq", money_req_seq);
                dbManager.AddParameters(2, "@emp_seq", emp_seq);
                dbManager.AddParameters(3, "@contact_seq", contact_seq);
                dbManager.AddParameters(4, "@job_site_seq", job_site_seq);
                dbManager.AddParameters(5, "@pos_seq", pos_seq);
                dbManager.AddParameters(6, "@class_seq", class_seq);
                dbManager.AddParameters(7, "@old_class_seq", old_class_seq);

                dbManager.AddParameters(8, "@record_status", SystemInfo._ActiveRecordStatus);
                dbManager.AddParameters(9, "@created_by", created_by);
                dbManager.AddParameters(10, "@created_when", DateTime.Today);

                strSQL = "INSERT INTO fim_money_request_travelers"
                    + "(money_req_seq, emp_seq, contact_seq"
                    + ", contact_person_seq, job_site_seq, pos_seq"
                    + ", class_seq, old_class_seq"
                    + ", record_status, created_by, created_when)"
                    + " VALUES(@money_req_seq"
                        + ", @emp_seq"
                        + ", @contact_seq"
                        + ", @contact_person_seq"
                        + ", @job_site_seq"
                        + ", @pos_seq"
                        + ", @class_seq"
                        + ", @old_class_seq"

                        + ", @record_status"
                        + ", @created_by"
                        + ", @created_when)";

                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);
            }
            catch
            {
                throw;
            }
            finally
            {
                dbManager.Dispose();
            }
        }
    }
}
